﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace WebsiteClient.Models
{
    public class ExternalLoginConfirmationViewModel
    {
        [Required]
        [Display(Name = "Email")]
        public string Email { get; set; }
    }

    public class ExternalLoginListViewModel
    {
        public string ReturnUrl { get; set; }
    }

    public class SendCodeViewModel
    {
        public string SelectedProvider { get; set; }
        public ICollection<System.Web.Mvc.SelectListItem> Providers { get; set; }
        public string ReturnUrl { get; set; }
        public bool RememberMe { get; set; }
    }

    public class VerifyCodeViewModel
    {
        [Required]
        public string Provider { get; set; }

        [Required]
        [Display(Name = "Code")]
        public string Code { get; set; }
        public string ReturnUrl { get; set; }

        [Display(Name = "Remember this browser?")]
        public bool RememberBrowser { get; set; }

        public bool RememberMe { get; set; }
    }

    public class ForgotViewModel
    {
        [Required]
        [Display(Name = "Email")]
        public string Email { get; set; }
    }

    public class LoginViewModel
    {
        [Required]
        [Display(Name = "Email")]
        [EmailAddress]
        public string Email { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterViewModel
    {
        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [EmailAddress(ErrorMessage="Indtast en valid email")]
        [Display(Name = "Email")]
        public string Email { get; set; }

        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [Display(Name = "Gade")]
        public string Street { get; set; }

        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [Display(Name="Husnummer")]
        public string StreetNumber { get; set; }
        
        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [RegularExpression("^[0-9]{4}$", ErrorMessage = "Postnummer skal være 4 tal")]
        [Display(Name="Postnummer")]
        public int ZipCode { get; set; }

        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [RegularExpression("^^[A-ZÆØÅa-zæøå ]+$", ErrorMessage = "By må ikke indeholde tal eller specialtegn")]
        [Display(Name="By")]
        public string City { get; set; }

        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [StringLength(100, ErrorMessage = "{0} skal være mindst {2} tegn.", MinimumLength = 8)]
        [DataType(DataType.PhoneNumber)]
        [Phone(ErrorMessage = "{0} er ikke gyldig")]
        [Display(Name = "Telefon nummer")]
        public string PhoneNumber { get; set; }

        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [DisplayName]
        [Display(Name = "Navn")]
        [StringLength(100, ErrorMessage = "{0} skal være mindst {2} cifre.", MinimumLength = 6)]
        [RegularExpression("^[A-ZÆØÅa-zæøå ]+$", ErrorMessage = "Navn må ikke indeholde tal eller specialtegn")]
        [DataType(DataType.Text)]
        public string Name { get; set; }

        [RequiredAttribute(ErrorMessage = "{0} feltet skal være udfyldt.")]
        [StringLength(100, ErrorMessage = "{0} skal være mindst {2} tegn.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Bekræft password")]
        [Compare("Password", ErrorMessage = "Det bekræftede password passer ikke.")]
        public string ConfirmPassword { get; set; }

        public string BirthDay { get; set; }

        public int Role { get; set; }
    }

    public class ResetPasswordViewModel
    {
        [Required]
        [EmailAddress]
        [Display(Name = "Email")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        public string Code { get; set; }
    }

    public class ForgotPasswordViewModel
    {
        [Required]
        [EmailAddress]
        [Display(Name = "Email")]
        public string Email { get; set; }
    }
}
